# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=http-enum
pkgver=0.4
pkgrel=4
pkgdesc='A tool to enumerate the enabled HTTP methods supported on a webserver.'
arch=('any')
url='https://www.thexero.co.uk/tools/http-enum/'
license=('custom:unknown')
depends=('python2')
groups=('blackarch' 'blackarch-scanner')
source=("https://github.com/nullsecuritynet/tools/raw/main/scanner/$pkgname/release/$pkgname-$pkgver.tar.gz")
sha512sums=('968c51c047163dccd8e51da4169dc4ef33b8d2f32775aef6e60e44791030c1abbc987a2d3486c713539d38109596b546e39f18948d73b0d80708d823a526a723')

prepare() {
  cd "$pkgname-$pkgver"

  sed -i '1s|python$|env python2|' http-enum
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp -a * "$pkgdir/usr/share/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

